<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!--返回错误信息-->
<?php echo validation_errors(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php
//    echo '<pre>';
//    print_r($list);
//    die;
    $title = [
        'title' => '招投标项目定标',
    ];
    $this->load->view('/admin/common/header', $title);
    ?>
</head>

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    <!--    头部   侧边菜单-->
    <?php $this->load->view('/admin/common/bodyLeft'); ?>
    <script type="text/javascript">
    	$(".js-sidebar-nav>li:nth-child(12)>ul").show(80);
    	$(".js-sidebar-nav>li:nth-child(12)>a>span").addClass("sidebar-nav-sub-ico-rotate");
    	$(".js-sidebar-nav>li:nth-child(12)>ul>li:nth-child(4)>a").addClass("active");
    </script>
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper confirm-tender">
			<div class="row-content am-cf">
				<div class="row">
					<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
						<div class="widget am-cf">
							<div class="widget-head am-cf">
								<div class="widget-title  am-cf">
									<ol class="am-breadcrumb am-breadcrumb-slash">
                    					<li><a href="/admin/bidding/confirmList?page=1">招投标管理</a></li>
										<li>定标详情</li>
									</ol>
								</div>
							</div>
							<form class="am-form am-text-sm" id="submitForm" action="/api/qiyuesuo/createByLocal" method="post" enctype="multipart/form-data">
								<div class="widget-body am-fr">
									<div class="tpl-table-black-operation">
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">
											基本信息
										</a>
									</div>

									<div style="margin-top: 20px">
										<div class="am-g">
											<!-- Row start -->
											<div class="am-u-sm-12">
												<div class="am-g-fixed am-cf">
													<div class="am-u-md-6">														
														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="projectid">招标项目编号</label>
																<div class="am-u-md-10">
																	<input name="code" type="text" value="<?php echo $list['code'] ?>" id="projectid" disabled="disabled">
																</div>
															</div>
														</div>

														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="name">项目名称</label>
																<div class="am-u-md-10">
																	<input type="text" name="name" value="<?php echo $list['name'] ?>" id="name" disabled="disabled">
																</div>
															</div>
														</div>

														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="time">发布时间</label>
																<div class="am-u-md-10">
																	<input type="date" class="am-u-md-10 form-control" value="<?php echo date('Y-m-d',$list['createTime']) ?>" id="time" disabled="disabled">
																</div>
															</div>
														</div>
														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 ">所在地区</label>
																<div class="am-u-md-10">
													      			<input type="text" name="" value="<?php echo $list['address']?>" disabled="disabled">
																</div>
															</div>
														</div>
														
													</div>

													<div class="am-u-md-6">
                                                        
                                                            <?php
                                                                if($list['needCode']){
                                                                    echo '<div class="am-form-group">
                                                                    <div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="xqdid">需求单号</label>
																<div class="am-u-md-10">
																	<input type="text" name="needCode" value="'.$list['needCode'].'" id="xqdid" disabled="disabled">
																</div>
																	</div>
																	</div>';
                                                                }else{
                                                                    echo '';
                                                                }
                                                            ?>

														
														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="timelimit">有效时间</label>
																<div class="am-u-md-10">
																	<input type="tel" name="validTime" value="<?php echo $list['validTime']?>" id="timelimit" disabled="disabled">
																</div>
															</div>
														</div>
	
												    	<div class="am-form-group am-form-file">
															<div class="am-g">
														      <label class="am-u-sm-2 am-form-label" for="file-2">项目附件</label>
														      <div class="am-inline-block am-u-sm-10">
                                                                  <?php
                                                                  if($list['projectImg']){
                                                                      echo '<a href="'.$list['projectImg'].'" download="项目附件">下载</a>';
                                                                  }else{
                                                                      echo '<a href="javascript:;">未上传</a>';

                                                                  }
                                                                  ?>
														      </div>
													      </div>
													    </div>
												    	<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 ">有效期状态</label>
																<div class="am-u-md-10">
													      			<input type="text" class="form-control am-u-md-10" name="" disabled="disabled">
																</div>	
															</div>
														</div>
													</div>
													
													<div class="am-form-group  am-u-md-12">
														<div class="am-g">
															<label class="am-u-md-2">预选供应商</label>
																<table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped" id="example-r">
																  <thead>
																	  <tr>
																	    <th>供应商编号</th>
																	    <th>供应商名称</th>
																	    <th>供应商地址</th>
																	  </tr>
																  </thead>
																  <tbody>
                                                                  <?php
                                                                  foreach ($list['supplierInfo'] as $k=>$v){
                                                                      echo '<tr>
																  		<td>'.$v['id'].'</td>
																  		<td>'.$v['name'].'</td>
																  		<td>'.$v['address'].'</td>
																  	</tr>';
                                                                  }
                                                                  ?>
																  </tbody>
																</table>																
															</div>
														</div>
													</div>											
													
													<div class="am-form-group  am-u-md-12">
														<div class="am-g">
															<label class="am-u-md-2">项目简介</label>
															<div class="am-u-md-10">
                                                                <?php
                                                                echo trim($list['synopsis']);
                                                                ?>
															</div>	
														</div>
													</div>														
												</div>
											</div>
										</div>										
									</div>
									<div class="tpl-table-black-operation">
										<hr />
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">其他信息</a>
									</div>
									<br />
									
									<div class="am-form-group am-u-md-12 am-cf">
								    <label for="" class="am-u-sm-1 am-form-label">需要的资质</label>
								    <div class="am-u-sm-3">
								      	<div class="am-checkbox">
	                                        <?php
	                                        if($list['needData']){
	                                            echo '<label><input type="checkbox" class="needData-c" value="营业执照" disabled="disabled" checked="checked"/>营业执照</label>';
	                                        }else{
	                                            echo '<label><input type="checkbox" class="needData-c" value="营业执照" disabled="disabled" />营业执照</label>';

	                                        }
	                                        ?>
								      	</div>
								    </div>
									<div class="am-u-md-8"></div>

								  </div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="bzmoney" class="am-u-sm-1 am-form-label ">需要交纳保证金</label>
								   	<div class="am-u-md-3 am-input-group">
										<input type="number" id="bzmoney" name="needAmount" value="<?php echo $list['needAmount'] ?>" class="am-form-field" disabled="disabled"> 
									  	<span class="am-input-group-label">元</span>
									</div>
									<div class="am-u-md-8"></div>

                                  </div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="contacts" class="am-u-sm-1 am-form-label ">联系人</label>
								    <div class="am-u-md-3">
								    	<input type="text"  name="contactMan" value="<?php echo $list['contactMan'] ?>" class="form-control" disabled="disabled">
								    </div>
								    <div class="am-u-md-8"></div>
								  </div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="phone" class="am-u-sm-1 am-form-label ">联系电话</label>
								    <div class="am-u-md-3">
								    	<input type="tel"  name="phone" value="<?php echo $list['phone'] ?>" class="form-control" disabled="disabled">
								    </div>
								    <div class="am-u-md-8"></div>
								  </div>
								  

									
									<div class="tpl-table-black-operation  am-u-md-12">
										<hr />
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">
											文件
										</a>
									</div>
									<br />
									
							    <div class="am-form-group am-form-file am-u-md-12">
							    	<br />
							      <label class="am-u-sm-2 am-form-label " for="file-2">标书文件</label>
									<div class="am-inline-block">
                                        <?php
                                        if($list['biddingFile']){
                                            echo '<a href="'.$list['biddingFile'].'" download="标书文件">下载</a>';
                                        }else{
                                            echo '<a href="javascript:;">未上传</a>';

                                        }
                                        ?>
							      </div>
							    </div>
							    <div class="am-form-group am-form-file am-u-md-12">
							      <label class="am-u-sm-2 am-form-label ">采购清单</label>
							      <div class="am-inline-block">
                                      <?php
                                      if($list['procurementImg']){
                                          echo '<a href="'.$list['procurementImg'].'" download="标书文件">下载</a>';
                                      }else{
                                          echo '<a href="javascript:;">未上传</a>';

                                      }
                                      ?>
                                  </div>
							    </div>
							    
								<div class="tpl-table-black-operation am-u-md-12">
									<hr>
									<a href="javascript:void(0);" class="tpl-table-black-operation-del">供应商资料</a>
								</div>	
								<div class="am-u-md-12 r_box">
								    <p class="am-u-md-12">
								    	预选供应商<span class="r_num"><?php echo count($list['supplierInfo']) ?></span>个&nbsp;&nbsp;&nbsp;&nbsp;
								    	已评分<span class="r_num"><?php echo count($list['supplierInfo']) ?></span>个
								    	已上传资料<span class="r_num"><?php echo $list['validSupplierNum'] ?></span>个
								    </p>
							  	</div>
							  	<div class="am-u-md-12 am-g-fixed ">
							  	
								<div class="am-u-md-12 ul-pingfen">
									<ul class="ul-table-header">
										<li style="width: 25%">项目名称</li>
										<li style="width: 30%">供应商名称</li>
										<li style="width: 15%">评委</li>
										<li style="width: 15%">评分</li>
										<li style="width: 15%">最后得分</li>
									</ul>
									<ul class="ul-table ">
                                        <?php

//                                        print_r($list['newCheckInfo']);
//                                        die();
                                             $q = count($list['newCheckInfo']);
                                            foreach ($list['newCheckInfo'] as $k8=>$v8){
                                                $e = count($v8);

                                                $r = 40 * $q * $e;
                                            }
                                            unset($v8);

                                            echo '<li class="project-name am-vertical-align " style="width: 25%;height: '.$r.'px;">
											<div class="am-vertical-align-middle">招标项目一</div>
										</li>';
                                        ?>

										<li class="supplier-box" style="width: 30%">
                                            <?php
                                                foreach ($list['newCheckInfo'] as $k2=>$v2){
                                                    $num = count($v2);
                                                    $l = 40 * $num;
                                                    echo '<ul class="supplier-name-box">
												<li class="supplier-name am-vertical-align" style="height: '.$l.'px;">
													<div class="am-vertical-align-middle">
														'.$k2.'
													</div>
												</li>
											</ul>';
                                                }
                                                unset($v2);
                                            ?>
										</li>
										<li class="judge-box" style="width: 15%">
                                            <?php

                                                foreach ($list['newCheckInfo'] as $k3=>$v3){
                                                    echo '<ul class="judge-name-box">';

                                                    foreach ($v3 as $k4=>$v4){

                                                        echo '<li class="judge-name am-vertical-align">
													<div class="am-vertical-align-middle">
														'.@$v4['checkUser'].'
													</div>
												</li>';

                                                    }
                                                    echo '</ul>';
                                                }
                                            unset($v3);

                                            ?>
										</li>
										<li class="grade-box" style="width: 15%">
                                            <?php
                                                foreach ($list['newCheckInfo'] as $k5=>$v5){
                                                    echo '<ul class="grade-num-box">';

                                                    foreach ($v5 as $k6=>$v6){
                                                        echo '<li class="grade-num am-vertical-align">
													<div class="am-vertical-align-middle">
														'.@$v6['score'].'
													</div>
												</li>';
                                                    }

                                                    echo '</ul>';
                                                }
                                                unset($v5);
                                            ?>
										</li>
										<li class="zonghe-box" style="width: 15%">
                                            <?php
                                                foreach ($list['newCheckInfo'] as $k7=>$v7){
                                                    $count2 = count($v7);

                                                    echo '<ul class="zonghe">
												<li class="zonghe-grade am-vertical-align" style="height: '.$l.'px;">
													<div class="am-vertical-align-middle">
														'.$v7[0]['mean'].'
													</div>
												</li>
											</ul>';
                                                }
                                                unset($v7);
                                            ?>
<!--											<ul class="zonghe">-->
<!--												<li class="zonghe-grade am-vertical-align" style="height: 120px;">-->
<!--													<div class="am-vertical-align-middle">-->
<!--														12-->
<!--													</div>-->
<!--												</li>-->
<!--											</ul>-->
<!--											<ul class="zonghe">-->
<!--												<li class="zonghe-grade am-vertical-align" style="height: 120px;">-->
<!--													<div class="am-vertical-align-middle">-->
<!--														123-->
<!--													</div>-->
<!--												</li>-->
<!--											</ul>-->
										</li>
									</ul>
								</div>
                                    <!--  审核评分信息  -->
							  	</div>
							  	<div class="tpl-table-black-operation am-u-md-12">
									<hr />
									<a href="javascript:void(0);" class="tpl-table-black-operation-del">定标管理</a>
								</div>
								<div class="am-u-md-12 am-form-group  am-g-fixed">
									<br />
									<div class="am-form-group">
									    <label for="" class="am-u-sm-2 am-form-label must">选定供应商：</label>
									    <div class="am-u-sm-10">
										    <select data-am-selected="{btnWidth: '40%', btnSize: 'sm'}" name="supplierId" id="supplierId">
                                                <?php
                                                    foreach ($list['newCheckInfo'] as $k9=>$v9){
                                                        foreach ($v9 as $k10=>$v10){
                                                            echo '<option value=""></option>';
                                                        }

                                                        echo '<option value="'.$v10['supplierId'].'">'.$k9.'</option>';

                                                    }
                                                ?>

											</select>
									    	<!-- <input type="text" name="supplierName" class="am-u-sm-10 form-control" placeholder="请输入最终选定的供应商，多个供应商用分号隔开" id="supplierName"> -->
									    </div>
									</div>
<!--                                    定标表的关联标书id,应该是唯一性的 -->
									<input type="hidden" class="relevanceId" name="relevanceId" value="<?php echo $_GET['relevanceId'] ?>">
<!--                                    审核表id -->
									<input type="hidden" class="checkId" name="checkId" value="<?php echo $_GET['id'] ?>">
								</div>
								<div class="am-u-md-12 am-form-group  am-g-fixed ">
									<div class="am-form-group am-form-file">
									    <label for="" class="am-u-sm-2 am-form-label must">上传电子订购单：</label>
									    <div class="am-u-sm-10">
									    	<button type="button" class="am-btn am-btn-default am-btn-sm">
											    <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
											<input type="file"  accept="application/pdf" name="dzPurchaseOrder" id="dzPurchaseOrder" />
											<span class="notice" style="color: red; font-weight: bold;">注：必须上传PDF文件！</span>
											<span class="file-show"></span>
									    </div>
									</div>
								</div>
							    <div class="am-g-fixed">
									<div class="btn-box">
			                            <button type="button" name="action" class="am-btn am-btn-primary tpl-btn-bg-color-success commit" style="width:150px;margin: 20px;">提交</button>
			                          	<button onclick="back()" class="am-btn am-btn-primary tpl-btn-bg-color-success" style="width:150px;margin: 20px;"> 取消</button>	                                    
                 					</div>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
    function search123() {
        var v = document.getElementById('search').value;
        console.log(v);

//        console.log(document.getElementById('searchData').value);
        window.location.href='?page=1'+'&search='+v

    }


	$("#dzPurchaseOrder").change(function (event) {
        var filePath = $(this).val();
        if(filePath){
            var arr = filePath.split('\\');
            var fileName = arr[arr.length-1];
            $(this).parent().find(".file-show").html(fileName);
            $(this).parent().find(".notice").css("display","none");
        }else{
            $(this).parent().find(".file-show").html("");
            $(this).parent().find(".notice").css("display","block");
            return false;
        }
        
    });
	


    $(".commit").on("click",function(){
//    	var checkInfoString = $("#checkInfoString").val();

    	var checkInfoString = '<?php echo json_encode($list['checkInfo'],JSON_UNESCAPED_UNICODE) ?>';
    	// console.log(checkInfoString);

    	var supplierId = $("#supplierId").val();
        // alert(checkInfoString + "  +++"+ supplierId );
        $.ajax({
            url:"/admin/bidding/refund",
            data:{
                checkInfoString: checkInfoString,
                supplierId: supplierId
            },
            type:"post",
            success:function(){
                $("#submitForm").submit();
            }
        });
    });


</script>


<script src="/assets/js/amazeui.min.js"></script>
<script src="/assets/js/amazeui.datatables.min.js"></script>
<script src="/assets/js/dataTables.responsive.min.js"></script>
<script src="/assets/js/app.js"></script>
<script src="/assets/js/zdy_form.js"></script>

<script>
// $(".commit").on("click",function() {
// 	var valid = zdy.validate.valid({
//		rules:{
//			supplierName:{required:true},
//			dzPurchaseOrder:{required:true},
//		}, message:{
//			supplierName:{required:"选定供应商不能为空"},
//			dzPurchaseOrder:{required:"请上传电子订购单"},
//		}
//	});
// 	if(!valid){
//		return false;
// 	}
// });


</script>
</body>

</html>